import java.util.ArrayList;
import java.util.List;

public class Friday {
    /**
     * 游戏中野人星期五的类
     *
     * @param strength          星期五的体力，取值范围为[0,100]
     * @param is_work            记录星期五在每一年中，是否参与第i次工作
     * @param obedience         星期五对鲁滨逊的服从程度，过低时可能引发内讧
     */
    private double strength = 80;
    private double obedience = 100;
    List<Integer> is_work = new ArrayList<>();

    public static final int O_MIN = 0;
    public static final int O_MAX = 100;

    public double getStrength() {
        return strength;
    }
    /**
     * 增减星期五体力值的类
     *
     * @param amount    需要增减的数值，正数为增，负数为减
     */
    public void setStrength(double amount) {
        if (strength + amount > Robinson.S_MAX) {
            strength = Robinson.S_MAX;
        }
        else if (strength + amount < Robinson.S_MIN) {
            strength = Robinson.S_MIN;
        }
        else {
            strength += amount;
        }
    }

    public double getObedience() {
        return obedience;
    }
    /**
     * 增减星期五服从度的类
     *
     * @param amount    需要增减的数值，正数为增，负数为减
     */
    public void setObedience(double amount) {
        if (strength + amount > O_MAX) {
            strength = O_MAX;
        }
        else if (strength + amount < O_MIN) {
            strength = O_MIN;
        }
        else {
            strength += amount;
        }
    }

    public List<Integer> getIs_work() {
        return is_work;
    }

    public void setIs_work(List<Integer> is_work) {
        this.is_work = is_work;
    }

    public Friday(int times){
        // 生成长度为times的数组
        while (times > 0) {
            is_work.add(0);
            times --;
        }
    }
    public Friday(Friday friday){
        this.is_work = friday.getIs_work();
        this.strength = friday.getStrength();
        this.obedience = friday.getObedience();
    }
}
